package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.util.Vector;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultCellEditor;
import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaConsultaProducto extends javax.swing.JFrame {
	private JPanel jPconsultaproducto;
	private JLabel jLbconsultaproduco;
	private JButton jBCancelar;
	private JScrollPane jScproducto;
	private JTable jTProducto;
	private JLabel jLimagen;

	/**
	* Auto-generated main method to display this JFrame
	*/
	
	
	public VentanaConsultaProducto() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Sistema de Almacen - Consulta de Productos Disponibles");
			{
				jPconsultaproducto = new JPanel();
				getContentPane().add(jPconsultaproducto, BorderLayout.CENTER);
				jPconsultaproducto.setBackground(new java.awt.Color(255,255,255));
				jPconsultaproducto.setPreferredSize(new java.awt.Dimension(462, 378));
				jPconsultaproducto.setLayout(null);
				jPconsultaproducto.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				{
					jLbconsultaproduco = new JLabel();
					jPconsultaproducto.add(jLbconsultaproduco);
					jLbconsultaproduco.setText("Informacion del producto");
					jLbconsultaproduco.setBounds(169, 38, 180, 20);
					jLbconsultaproduco.setFont(new java.awt.Font("Tahoma",0,16));
				}
				{
					jLimagen = new JLabel();
					jPconsultaproducto.add(jLimagen);
					jLimagen.setBounds(2, 4, 34, 368);
					jLimagen.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen/fondo7.jpg")));
				}
				
				{
					jBCancelar = new JButton();
					jPconsultaproducto.add(jBCancelar);
					jBCancelar.setBounds(212, 291, 90, 34);
					jBCancelar.setIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen/Boton_Cancelar2.jpg")));
					jBCancelar.setRolloverIcon(new ImageIcon(getClass().getClassLoader().getResource("imagen/Boton_Cancelar.jpg")));
					jBCancelar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
					jBCancelar.setActionCommand("Cancelar");
				}
				{
					jScproducto = new JScrollPane();
					jPconsultaproducto.add(jScproducto);
					jScproducto.setBounds(48, 88, 447, 128);
					{
						DefaultTableModel jTProductoModel = 
								new DefaultTableModel(
										new String[][] {},
										new String[] { "Codigo", "Producto","Cantidad disponible" });
						jTProducto = new JTable();
						jScproducto.setViewportView(jTProducto);
						jTProducto.setModel(jTProductoModel);
					}
				}
			}
			pack();
			this.setSize(517, 405);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	public void agregarListener(ActionListener accion) {

		jBCancelar.addActionListener(accion);
	
	}
	
	public void mostrarMensaje(String mensaje) {
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	public void agregarFilaProducto(Vector<String> datoProducto) {
		DefaultTableModel tabla = (DefaultTableModel) this.jTProducto
				.getModel();

		tabla.addRow(datoProducto);


	}

}
